<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Test Page for geoPolygonUtils.googleMapsAdapter.* functions</title>
  <script language="JavaScript" type="text/javascript"
      src="../tools/jsunit/app/jsUnitCore.js"></script>
  <script language="JavaScript" type="text/javascript"
      src="test-utils.js"></script>
  <script language="JavaScript" type="text/javascript"
      src="../src/geometry.js"></script>
  <script language="JavaScript" type="text/javascript"
      src="../src/google-maps-adapter.js"></script>
  <script language="JavaScript" type="text/javascript">

    // Alias for the Vector class.
    var Vector = geoPolygonUtils.geometry.Vector;
    
    
    // Alias for latlngToMercator function.
    var latlngToMercator = geoPolygonUtils.googleMapsAdapter.latlngToMercator;
    
    
    // Alias for latlngFromMercator function.
    var latlngFromMercator = geoPolygonUtils.googleMapsAdapter.latlngFromMercator;
    
    
    function assertConversion(lat, lng, x, y) {
      assertVectorCoords('lat/lng to mercator', x, y, latlngToMercator(lat, lng));
      var latlng = latlngFromMercator(x, y);
      assertVectorCoords('mercator to lat/lng', lat, lng, new Vector(latlng[0], latlng[1]));
    };
    
    
    function testLatlngMercatorConversion() {
      assertConversion(0.0, 0.0, 0.5, 0.5);
      assertConversion(85.05112878, -180.00000000, 0.0, 0.0);
      assertConversion(-85.05112878, 180.00000000, 1.0, 1.0);
      assertConversion(66.51326044, 90.00000000, 0.75, 0.25);
      assertConversion(-52.06978230, -61.20000000, 0.33, 0.67);
      assertConversion(55.755738, 37.616801, 0.60449111, 0.31260288);
    };

    
  </script>
  <style>
    .code {
      color: green;
      font-weight: bold;
    }
  </style>
</head>
<body>
  <h1>Test Page for <span class="code">geoPolygonUtils.googleMapsAdapter.*</span>
  functions.</h1>
  <p>This page contains tests for the methods of <span class="code">
  geoPolygonUtils.googleMapsAdapter.*</span> functions. To see them take a look at the
  source of the page.</p>
  <p><em>Note:</em> this file is intended to be used with
  <a href="http://www.jsunit.net/">JSUnit</a> test framework.</p>
</body>
</html>
